package main

import (
	"fmt"
	"runtime"
	"sync"
)

func work(wg *sync.WaitGroup, index int){
	for i:=0;i<10;i++{
		fmt.Printf("[%d-%d] ",index,i)
		if i == index{
			runtime.Gosched()
		}
	}
	wg.Done()
}

func main(){
	runtime.GOMAXPROCS(runtime.NumCPU()/2)
	var wg sync.WaitGroup
	wg.Add(3)
	for i:=0;i<3;i++{
		go work(&wg,i)
	}
	wg.Wait()
	fmt.Println()
}